# 对函数添加认证登录功能，必须登录后才能使用函数
def index():
    print('from index')


def home():
    print('from home')


def find():
    print('from find')


def login_auth(func):
    def auth(*args, **kwargs):
        username = input("username:").strip()
        password = input("password:").strip()

        if username == '11' and password == '11':
            print('登录成功')
            return func(*args, **kwargs)
        else:
            print('用户名或者密码错误')

    return auth


index = login_auth(index)
index()

home = login_auth(home)
home()
